﻿@inherits ProComponentBase

<SSimpleModal Value="_visible" ValueChanged="HandleVisibleChanged" OnSave="Submit" SaveText="@T("Submit")"
              Title="@T("AddResourceFiles")" HeaderClass="mr-4">
    <MForm Model=Model EnableValidation @ref="_form" Class="full-height">
         <div class="rounded-6 d-flex flex-column align-center py-10" style="border: 4px dashed #E2E7F4;">
            <MHover OpenDelay="200" Context="hover">
                <div @attributes="hover.Attrs">
                    <MProgressCircular Value="_progress" Size="200" Width="18" Color="gradient">
                        <div class="upload-btn">
                            <MImage Width=80 Height=80 Class="d-flex justify-center align-center" ContentClass="text-center"
                                    Src="@(_isUploadSuccess.HasValue?(_isUploadSuccess==false?"_content/Masa.Scheduler.Web.Admin/img/upload/upload-error.png":"_content/Masa.Scheduler.Web.Admin/img/upload/upload-complete.png"):hover.Hover?"_content/Masa.Scheduler.Web.Admin/img/upload/upload-active.png":"_content/Masa.Scheduler.Web.Admin/img/upload/upload.png")">
                            </MImage>
                            <MFileInput TValue="IBrowserFile"
                                @ref="_ref"
                                Dense
                                Outlined
                                Accept=".zip, .dll"
                                Rules="_rules"
                                @bind-Value="_browserFile"
                                Class="full-width full-height"
                                HideDetails="@("auto")"
                                Label="@T("PleaseUploadFiles")"
                                Placeholder="@T("PleaseUploadFiles")" OnChange="HandleFileChange"></MFileInput>
                        </div>
                    </MProgressCircular>

                </div>
            </MHover>
            <div class="d-flex flex-column align-center mt-6">
                        <div class="h6 regular--text">@(_isUploadSuccess == null ? T("UploadFile") : (_isUploadSuccess == true ? T("UploadComplete") : T("UploadFileFailed")))</div>
                <div class="body regular3--text mt-2">@(_isUploadSuccess == true ? Model.Name : T("UploadFiles.Tips"))</div>
            </div>
        </div>
        <STextField @bind-Value="Model.Version" Label="@T(nameof(Model.Version))" Class="mt-9" />
        <STextarea @bind-Value="Model.Description" Label="@T(nameof(Model.Description))" Class="mt-9" HideDetails="@("auto")" Outlined />
    </MForm>
</SSimpleModal>